\(\int \cos (c+d x) \sqrt {a+a \sec (c+d x)} (A+B \sec (c+d x)+C \sec ^2(c+d x)) \, dx\) [487]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 41, antiderivative size = 98 \[ \int \cos (c+d x) \sqrt {a+a \sec (c+d x)} \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {\sqrt {a} (A+2 B) \arctan \left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {a+a \sec (c+d x)}}\right )}{d}+\frac {A \sqrt {a+a \sec (c+d x)} \sin (c+d x)}{d}-\frac {a (A-2 C) \tan (c+d x)}{d \sqrt {a+a \sec (c+d x)}} \]

[Out]

(A+2*B)*arctan(a^(1/2)*tan(d*x+c)/(a+a*sec(d*x+c))^(1/2))*a^(1/2)/d+A*sin(d*x+c)*(a+a*sec(d*x+c))^(1/2)/d-a*(A
-2*C)*tan(d*x+c)/d/(a+a*sec(d*x+c))^(1/2)

Rubi [A] (verified)

Time = 0.25 (sec) , antiderivative size = 98, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.122, Rules used = {4171, 4000, 3859, 209, 3877} \[ \int \cos (c+d x) \sqrt {a+a \sec (c+d x)} \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {\sqrt {a} (A+2 B) \arctan \left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {a \sec (c+d x)+a}}\right )}{d}-\frac {a (A-2 C) \tan (c+d x)}{d \sqrt {a \sec (c+d x)+a}}+\frac {A \sin (c+d x) \sqrt {a \sec (c+d x)+a}}{d} \]

[In]

Int[Cos[c + d*x]*Sqrt[a + a*Sec[c + d*x]]*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

(Sqrt[a]*(A + 2*B)*ArcTan[(Sqrt[a]*Tan[c + d*x])/Sqrt[a + a*Sec[c + d*x]]])/d + (A*Sqrt[a + a*Sec[c + d*x]]*Si
n[c + d*x])/d - (a*(A - 2*C)*Tan[c + d*x])/(d*Sqrt[a + a*Sec[c + d*x]])

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 3859

Int[Sqrt[csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Dist[-2*(b/d), Subst[Int[1/(a + x^2), x], x, b*(C
ot[c + d*x]/Sqrt[a + b*Csc[c + d*x]])], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b^2, 0]

Rule 3877

Int[csc[(e_.) + (f_.)*(x_)]*Sqrt[csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Simp[-2*b*(Cot[e + f*x]/(
f*Sqrt[a + b*Csc[e + f*x]])), x] /; FreeQ[{a, b, e, f}, x] && EqQ[a^2 - b^2, 0]

Rule 4000

Int[Sqrt[csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)]*(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_)), x_Symbol] :> Dist[c, In
t[Sqrt[a + b*Csc[e + f*x]], x], x] + Dist[d, Int[Sqrt[a + b*Csc[e + f*x]]*Csc[e + f*x], x], x] /; FreeQ[{a, b,
 c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 - b^2, 0]

Rule 4171

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(d_.))^
(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_), x_Symbol] :> Simp[A*Cot[e + f*x]*(a + b*Csc[e + f*x])^m*((d*
Csc[e + f*x])^n/(f*n)), x] - Dist[1/(b*d*n), Int[(a + b*Csc[e + f*x])^m*(d*Csc[e + f*x])^(n + 1)*Simp[a*A*m -
b*B*n - b*(A*(m + n + 1) + C*n)*Csc[e + f*x], x], x], x] /; FreeQ[{a, b, d, e, f, A, B, C, m}, x] && EqQ[a^2 -
 b^2, 0] &&  !LtQ[m, -2^(-1)] && (LtQ[n, -2^(-1)] || EqQ[m + n + 1, 0])

Rubi steps \begin{align*} \text {integral}& = \frac {A \sqrt {a+a \sec (c+d x)} \sin (c+d x)}{d}+\frac {\int \sqrt {a+a \sec (c+d x)} \left (\frac {1}{2} a (A+2 B)-\frac {1}{2} a (A-2 C) \sec (c+d x)\right ) \, dx}{a} \\ & = \frac {A \sqrt {a+a \sec (c+d x)} \sin (c+d x)}{d}+\frac {1}{2} (A+2 B) \int \sqrt {a+a \sec (c+d x)} \, dx+\frac {1}{2} (-A+2 C) \int \sec (c+d x) \sqrt {a+a \sec (c+d x)} \, dx \\ & = \frac {A \sqrt {a+a \sec (c+d x)} \sin (c+d x)}{d}-\frac {a (A-2 C) \tan (c+d x)}{d \sqrt {a+a \sec (c+d x)}}-\frac {(a (A+2 B)) \text {Subst}\left (\int \frac {1}{a+x^2} \, dx,x,-\frac {a \tan (c+d x)}{\sqrt {a+a \sec (c+d x)}}\right )}{d} \\ & = \frac {\sqrt {a} (A+2 B) \arctan \left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {a+a \sec (c+d x)}}\right )}{d}+\frac {A \sqrt {a+a \sec (c+d x)} \sin (c+d x)}{d}-\frac {a (A-2 C) \tan (c+d x)}{d \sqrt {a+a \sec (c+d x)}} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.66 (sec) , antiderivative size = 94, normalized size of antiderivative = 0.96 \[ \int \cos (c+d x) \sqrt {a+a \sec (c+d x)} \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {\sec \left (\frac {1}{2} (c+d x)\right ) \sqrt {a (1+\sec (c+d x))} \left (\sqrt {2} (A+2 B) \arcsin \left (\sqrt {2} \sin \left (\frac {1}{2} (c+d x)\right )\right ) \sqrt {\cos (c+d x)}+2 (2 C+A \cos (c+d x)) \sin \left (\frac {1}{2} (c+d x)\right )\right )}{2 d} \]

[In]

Integrate[Cos[c + d*x]*Sqrt[a + a*Sec[c + d*x]]*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

(Sec[(c + d*x)/2]*Sqrt[a*(1 + Sec[c + d*x])]*(Sqrt[2]*(A + 2*B)*ArcSin[Sqrt[2]*Sin[(c + d*x)/2]]*Sqrt[Cos[c +
d*x]] + 2*(2*C + A*Cos[c + d*x])*Sin[(c + d*x)/2]))/(2*d)

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(304\) vs. \(2(88)=176\).

Time = 2.20 (sec) , antiderivative size = 305, normalized size of antiderivative = 3.11

method result size
default \(\frac {\left (A \sqrt {-\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {arctanh}\left (\frac {\sin \left (d x +c \right )}{\left (\cos \left (d x +c \right )+1\right ) \sqrt {-\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}}\right ) \cos \left (d x +c \right )+2 B \,\operatorname {arctanh}\left (\frac {\sin \left (d x +c \right )}{\left (\cos \left (d x +c \right )+1\right ) \sqrt {-\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}}\right ) \sqrt {-\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \cos \left (d x +c \right )+A \sqrt {-\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {arctanh}\left (\frac {\sin \left (d x +c \right )}{\left (\cos \left (d x +c \right )+1\right ) \sqrt {-\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}}\right )+A \cos \left (d x +c \right ) \sin \left (d x +c \right )+2 B \sqrt {-\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {arctanh}\left (\frac {\sin \left (d x +c \right )}{\left (\cos \left (d x +c \right )+1\right ) \sqrt {-\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}}\right )+2 C \sin \left (d x +c \right )\right ) \sqrt {a \left (1+\sec \left (d x +c \right )\right )}}{d \left (\cos \left (d x +c \right )+1\right )}\) \(305\)

[In]

int(cos(d*x+c)*(A+B*sec(d*x+c)+C*sec(d*x+c)^2)*(a+a*sec(d*x+c))^(1/2),x,method=_RETURNVERBOSE)

[Out]

1/d*(A*(-cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*arctanh(sin(d*x+c)/(cos(d*x+c)+1)/(-cos(d*x+c)/(cos(d*x+c)+1))^(1/2)
)*cos(d*x+c)+2*B*arctanh(sin(d*x+c)/(cos(d*x+c)+1)/(-cos(d*x+c)/(cos(d*x+c)+1))^(1/2))*(-cos(d*x+c)/(cos(d*x+c
)+1))^(1/2)*cos(d*x+c)+A*(-cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*arctanh(sin(d*x+c)/(cos(d*x+c)+1)/(-cos(d*x+c)/(co
s(d*x+c)+1))^(1/2))+A*cos(d*x+c)*sin(d*x+c)+2*B*(-cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*arctanh(sin(d*x+c)/(cos(d*x
+c)+1)/(-cos(d*x+c)/(cos(d*x+c)+1))^(1/2))+2*C*sin(d*x+c))*(a*(1+sec(d*x+c)))^(1/2)/(cos(d*x+c)+1)

Fricas [A] (verification not implemented)

none

Time = 0.33 (sec) , antiderivative size = 272, normalized size of antiderivative = 2.78 \[ \int \cos (c+d x) \sqrt {a+a \sec (c+d x)} \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\left [\frac {{\left ({\left (A + 2 \, B\right )} \cos \left (d x + c\right ) + A + 2 \, B\right )} \sqrt {-a} \log \left (\frac {2 \, a \cos \left (d x + c\right )^{2} - 2 \, \sqrt {-a} \sqrt {\frac {a \cos \left (d x + c\right ) + a}{\cos \left (d x + c\right )}} \cos \left (d x + c\right ) \sin \left (d x + c\right ) + a \cos \left (d x + c\right ) - a}{\cos \left (d x + c\right ) + 1}\right ) + 2 \, {\left (A \cos \left (d x + c\right ) + 2 \, C\right )} \sqrt {\frac {a \cos \left (d x + c\right ) + a}{\cos \left (d x + c\right )}} \sin \left (d x + c\right )}{2 \, {\left (d \cos \left (d x + c\right ) + d\right )}}, -\frac {{\left ({\left (A + 2 \, B\right )} \cos \left (d x + c\right ) + A + 2 \, B\right )} \sqrt {a} \arctan \left (\frac {\sqrt {\frac {a \cos \left (d x + c\right ) + a}{\cos \left (d x + c\right )}} \cos \left (d x + c\right )}{\sqrt {a} \sin \left (d x + c\right )}\right ) - {\left (A \cos \left (d x + c\right ) + 2 \, C\right )} \sqrt {\frac {a \cos \left (d x + c\right ) + a}{\cos \left (d x + c\right )}} \sin \left (d x + c\right )}{d \cos \left (d x + c\right ) + d}\right ] \]

[In]

integrate(cos(d*x+c)*(A+B*sec(d*x+c)+C*sec(d*x+c)^2)*(a+a*sec(d*x+c))^(1/2),x, algorithm="fricas")

[Out]

[1/2*(((A + 2*B)*cos(d*x + c) + A + 2*B)*sqrt(-a)*log((2*a*cos(d*x + c)^2 - 2*sqrt(-a)*sqrt((a*cos(d*x + c) +
a)/cos(d*x + c))*cos(d*x + c)*sin(d*x + c) + a*cos(d*x + c) - a)/(cos(d*x + c) + 1)) + 2*(A*cos(d*x + c) + 2*C
)*sqrt((a*cos(d*x + c) + a)/cos(d*x + c))*sin(d*x + c))/(d*cos(d*x + c) + d), -(((A + 2*B)*cos(d*x + c) + A +
2*B)*sqrt(a)*arctan(sqrt((a*cos(d*x + c) + a)/cos(d*x + c))*cos(d*x + c)/(sqrt(a)*sin(d*x + c))) - (A*cos(d*x
+ c) + 2*C)*sqrt((a*cos(d*x + c) + a)/cos(d*x + c))*sin(d*x + c))/(d*cos(d*x + c) + d)]

Sympy [F]

\[ \int \cos (c+d x) \sqrt {a+a \sec (c+d x)} \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\int \sqrt {a \left (\sec {\left (c + d x \right )} + 1\right )} \left (A + B \sec {\left (c + d x \right )} + C \sec ^{2}{\left (c + d x \right )}\right ) \cos {\left (c + d x \right )}\, dx \]

[In]

integrate(cos(d*x+c)*(A+B*sec(d*x+c)+C*sec(d*x+c)**2)*(a+a*sec(d*x+c))**(1/2),x)

[Out]

Integral(sqrt(a*(sec(c + d*x) + 1))*(A + B*sec(c + d*x) + C*sec(c + d*x)**2)*cos(c + d*x), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 939 vs. \(2 (88) = 176\).

Time = 0.47 (sec) , antiderivative size = 939, normalized size of antiderivative = 9.58 \[ \int \cos (c+d x) \sqrt {a+a \sec (c+d x)} \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\text {Too large to display} \]

[In]

integrate(cos(d*x+c)*(A+B*sec(d*x+c)+C*sec(d*x+c)^2)*(a+a*sec(d*x+c))^(1/2),x, algorithm="maxima")

[Out]

1/4*(4*B*sqrt(a)*arctan2((cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/4)*sin(1/2*arct
an2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1)) + sin(d*x + c), (cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(
2*d*x + 2*c) + 1)^(1/4)*cos(1/2*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1)) + cos(d*x + c)) + (2*(cos(2*d
*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/4)*(cos(1/2*arctan2(sin(2*d*x + 2*c), cos(2*d*x
+ 2*c) + 1))*sin(d*x + c) - (cos(d*x + c) - 1)*sin(1/2*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1)))*sqrt(
a) + sqrt(a)*(arctan2(-(cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/4)*(cos(1/2*arcta
n2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1))*sin(d*x + c) - cos(d*x + c)*sin(1/2*arctan2(sin(2*d*x + 2*c), cos(
2*d*x + 2*c) + 1))), (cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/4)*(cos(d*x + c)*co
s(1/2*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1)) + sin(d*x + c)*sin(1/2*arctan2(sin(2*d*x + 2*c), cos(2*
d*x + 2*c) + 1))) + 1) - arctan2(-(cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/4)*(co
s(1/2*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1))*sin(d*x + c) - cos(d*x + c)*sin(1/2*arctan2(sin(2*d*x +
 2*c), cos(2*d*x + 2*c) + 1))), (cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/4)*(cos(
d*x + c)*cos(1/2*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1)) + sin(d*x + c)*sin(1/2*arctan2(sin(2*d*x + 2
*c), cos(2*d*x + 2*c) + 1))) - 1) - arctan2((cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)
^(1/4)*sin(1/2*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1)), (cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*
cos(2*d*x + 2*c) + 1)^(1/4)*cos(1/2*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1)) + 1) + arctan2((cos(2*d*x
 + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/4)*sin(1/2*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2
*c) + 1)), (cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/4)*cos(1/2*arctan2(sin(2*d*x
+ 2*c), cos(2*d*x + 2*c) + 1)) - 1)))*A)/d

Giac [F]

\[ \int \cos (c+d x) \sqrt {a+a \sec (c+d x)} \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\int { {\left (C \sec \left (d x + c\right )^{2} + B \sec \left (d x + c\right ) + A\right )} \sqrt {a \sec \left (d x + c\right ) + a} \cos \left (d x + c\right ) \,d x } \]

[In]

integrate(cos(d*x+c)*(A+B*sec(d*x+c)+C*sec(d*x+c)^2)*(a+a*sec(d*x+c))^(1/2),x, algorithm="giac")

[Out]

sage0*x

Mupad [F(-1)]

Timed out. \[ \int \cos (c+d x) \sqrt {a+a \sec (c+d x)} \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\int \cos \left (c+d\,x\right )\,\sqrt {a+\frac {a}{\cos \left (c+d\,x\right )}}\,\left (A+\frac {B}{\cos \left (c+d\,x\right )}+\frac {C}{{\cos \left (c+d\,x\right )}^2}\right ) \,d x \]

[In]

int(cos(c + d*x)*(a + a/cos(c + d*x))^(1/2)*(A + B/cos(c + d*x) + C/cos(c + d*x)^2),x)

[Out]

int(cos(c + d*x)*(a + a/cos(c + d*x))^(1/2)*(A + B/cos(c + d*x) + C/cos(c + d*x)^2), x)